<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <!-- <input v-model="value"> --><!-- 等同于 --><!-- <input :value="value" @input="value = $event.target.value"> -->

        <!-- 自定义组件实现 v-model -->
        <!-- <my-component v-model="price"/> -->
        <!-- 等同于 -->
        <my-component :value="price" @input="price = $event" />
    </div>
</body>     
</html>
<script>
    Vue.component('my-component',{
        props:['value'],
        template:`<div>
           <input :value="value" @input="$emit('input',$event.target.value)">
           {{value}}
        </div>`,
    })
    new Vue({
        el:'#app',
        data:{
            price:'1',
        },
        methods:{

        },
    })
</script>